Skip Headers

Oracle® OLAP Reference 10g Release 2 (10.2) Part Number B14350-01 |
Home | Book List | Contents | Index | Master Index | Feedback

Previous | Next
| View PDF

# Example: Using a Log File

The following example shows how to use the `CWM2_OLAP_MANAGER` package to direct a validation report to a log file.

Example 17-1 Direct a Validation Report to a File

    >set linesize 135
    >set pagesize 50

    >execute cwm2_olap_manager.begin_log
           ('/users/myuser' , 'Metadata_Validation_Report');
    >execute cwm2_olap_manager.log_note
           ('OLAP Metadata Validation Report' );
    >execute cwm2_olap_validate.validate_olap_catalog
           ('OLAP API');
    >execute cwm2_olap_manager.end_log;

The log file would look something like this.

    BEGIN: CwM2_OLAP Log  Date: 2004 APRIL     05  Time: 17:10:20 User: MYUSER.

    Log Directory: /users/myuser  Log File: Metadata_Validation_Report.

    OLAP Metadata Validation Report

    .Validate Olap Catalog

    .Validate Dimension: GLOBAL.CHANNEL    Type of Validation: OLAP API    Verbose Report: YES
    .Validating Dimension Metadata in OLAP Catalog 1  Date: 2004 APRIL     05  Time: 17:11:45
                                                      User: MYUSER  031201

    .ENTITY TYPE   ENTITY NAME        STATUS    COMMENT

    Dimension       GLOBAL.CHANNEL    VALID    Default_Display_Hierarchy: "CHANNEL_ROLLUP".
    .
    .
    .
    .
    .
    .
    END: CwM2_OLAP Log  Date: 2004 APRIL     05  Time: 17:12:11 User: MYUSER.
    Log Directory: /users/myuser  Log File: Metadata_Validation_Report.

# Summary of CWM2_OLAP_MANAGER Subprograms

Table 17-1 CWM2_OLAP_MANAGER

Subprogram | Description
--- | ---
BEGIN_LOG Procedure | Turns on logging.
END_LOG Procedure | Turns off logging.
LOG_NOTE Procedure | Writes a text string in the log file.
SET_ECHO_OFF Procedure | Turns on echoing to the screen.
SET_ECHO_ON Procedure | Turns off echoing to the screen.

## BEGIN_LOG Procedure

The `BEGIN_LOG` procedure directs the output from OLAP PL/SQL packages to a log file.

Syntax

    BEGIN_LOG (
              output_directory     IN   VARCHAR2,
              file_name            IN   VARCHAR2,
              append_to_file       IN   VARCHAR2 DEFAULT 'NO');

Parameters

Table 17-2 BEGIN_LOG Procedure Parameters

Parameter | Description
--- | ---
`output_directory` | Output directory for the log file. You can either specify a directory object, to which your user ID has been granted the appropriate access, or a path set by the `UTL_FILE_DIR` initialization parameter for the instance.
`file_name` | Name of log file.
`append_to_file` | Specify 'YES' to append the output to the end of the file. Specify 'NO' to delete the previous contents of the file before writing to it. The default is 'NO'.

Example

See "Example: Using a Log File".

## END_LOG Procedure

The `END_LOG` procedure turns off logging.

Syntax

    END_LOG;

Example

See "Example: Using a Log File".

## LOG_NOTE Procedure

When logging is turned on, the `LOG_NOTE` procedure writes the text that you specify to the log file. If logging is not turned on, this procedure has no effect.

Syntax

    LOG_NOTE  (
              message_text   IN   VARCHAR2);

Parameters

Table 17-3 LOG_NOTE Procedure Parameters

Parameter | Description
--- | ---
`message_text` | Text to write to the log file.

Example

See "Example: Using a Log File".

## SET_ECHO_OFF Procedure

`SET_ECHO_OFF` prevents the display of output generated by OLAP stored procedures.

Syntax

    SET_ECHO_OFF;

Example

The following example illustrates how the output from an OLAP DML command is displayed when echoing is turned on, but suppressed when echoing is turned off.

The PL/SQL calls are listed to the left, and the screen output is shown indented to the right.

    >execute cwm2_olap_manager.set_echo_on;

              PL/SQL procedure successfully completed.

    >execute dbms_aw.execute ('listnames');

              1 DIMENSION
              ------------------
              MYDIM

              PL/SQL procedure successfully completed.

    >execute cwm2_olap_manager.set_echo_off;

              PL/SQL procedure successfully completed.

    >execute dbms_aw.execute ('listnames');

              PL/SQL procedure successfully completed.

## SET_ECHO_ON Procedure

`SET_ECHO_ON` causes the output generated by OLAP stored procedures to be displayed on the screen.

Syntax

    SET_ECHO_ON;

Example

See the example in "SET_ECHO_OFF Procedure".